package cook
import org.apache.commons.collections.list.LazyList;
import org.apache.commons.collections.FactoryUtils;


class DishComponent {


	String name
	
	List ingredientItems
	static hasMany		= [ingredientItems:IngredientItem]	
	
    static mapping = {
		ingredientItems: "all-delete-orphan"
    }
    
	static constraints = {
    }
	

	public BigDecimal getCost(){
		BigDecimal cost = 0
		ingredientItems.each{
			cost += it.cost
		}
		return cost
	}
	
	public String toString() {
		return name
	}
}
